package edu.isquen.core.datasource.action;

public class DataSourceUtil {
	public static final String DBTYPE_ORACLE = "ORACLE";

	public static final String DBTYPE_MSSQL = "MSSQL";

	public static final String DBTYPE_MYSQL = "MYSQL";

	public static final String DBTYPE_HSQLDB = "HSQLDB";

	public static final String DBTYPE_DB2 = "DB2";

//	private static HashMap<String, String> _dbTypes = new HashMap<String, String>();

//	public static Collection<String> getTableNames(String applicationId) {
//		Collection<String> rtn = new ArrayList<String>();
//
//		Connection conn = null;
//		ResultSet tableSet = null;
//		try {
//			conn = getConnection(applicationId);
//
//			String catalog = null;
//			String schemaPattern = null;
//
//			String dbType = getDBType(applicationId);
//			String schema = getSchema(conn, dbType);
//
//			if (dbType.equals(DBTYPE_ORACLE)) {
//				schemaPattern = schema;
//			} else if (dbType.equals(DBTYPE_MSSQL)) {
//				schemaPattern = schema;
//			} else if (dbType.equals(DBTYPE_MYSQL)) {
//				catalog = schema;
//			} else if (dbType.equals(DBTYPE_HSQLDB)) {
//				schemaPattern = schema;
//			} else if (dbType.equals(DBTYPE_DB2)) {
//				schemaPattern = schema;
//			}
//
//			DatabaseMetaData metaData = conn.getMetaData();
//			tableSet = metaData.getTables(catalog, schemaPattern, null, new String[] { "TABLE" });
//
//			while (tableSet.next()) {
//				String tableName = tableSet.getString(3);
//				rtn.add(tableName);
//			}
//		} catch (Exception e) {
//			e.printStackTrace();
//		} finally {
//			try {
//				if (conn != null) {
//					conn.close();
//					tableSet.close();
//				}
//			} catch (SQLException e) {
//				e.printStackTrace();
//			}
//		}
//
//		return rtn;
//	}
}
